import React, {Component} from 'react'
import {observer} from 'mobx-react';
import { withRouter, Route } from 'react-router-dom';
import {Tools} from 'weaver-mobile';
import CustTabs from '../../coms/Tabs';
import RecordList from './RecordList';
import MySubordinates from '../../resource/MySubordinates';
import Subordinate from '../subordinate/index';
const getLabel = Tools.getLabel;

@withRouter
@observer
export default class RecordContainer extends Component {
  onRowClick = data => {
    const {store: {recordLayout: {path}}} = this.props;
    this.props.history.push({
      pathname: path, 
      state: {
          data
      }
    })
  }

  render() { 
    const {store} = this.props;
    const {baseInfo, recordInitialPage, setActiveTab, advanceSearchPageStore2} = store;
    const tabConfig = {
      tabs: [
          {title: getLabel('503732','我的外勤')},
          {title: getLabel('504541','下属外勤')}
      ],
      tabProps: {
          initialPage: recordInitialPage,
          page: recordInitialPage,
          onTabClick: (tab, index) => {
              setActiveTab(index);
          }
      }
    }

    return (
      <div className='recordContainer'>
        <CustTabs store={store} tabConfig={tabConfig}>
          <RecordList />
          <Subordinate resourceId={baseInfo.userid} onRowClick={this.onRowClick}/>
        </CustTabs>
      </div>
    )
  }
}